package exhi.action;

import org.springframework.ui.ModelMap;

import com.stp.core.util.Identities;

import exhi.entity.EntpBexhi;
import exhi.entity.EntpSexhi;

public class ViewExhiAct extends BaseAct {

	protected void showSexhiView(EntpSexhi entpSexhiInfo, ModelMap model) {		
		model.addAttribute("info", entpSexhiInfo);
		String zb = "";
		String qt = "";
		String cb = "";
		String zc = "";
		String xb = "";
		String exhiType = "";
		String zldd = "";
		if (entpSexhiInfo.getId() == null) {
			model.addAttribute("entpName", getEntpUser().getMc());
			model.addAttribute("projectId", Identities.uuid());
		} else {
			model.addAttribute("entpName", entpMng.get(entpSexhiInfo.getUid())
					.getMc());
			model.addAttribute("projectId", entpSexhiInfo.getId());
			if (null != entpSexhiInfo.getZid()
					&& entpMng.get(entpSexhiInfo.getZid()) != null) {
				zb = entpMng.get(entpSexhiInfo.getZid()).getMc();
			}

			if (null != entpSexhiInfo.getCid()
					&& entpMng.get(entpSexhiInfo.getCid()) != null) {
				cb = entpMng.get(entpSexhiInfo.getCid()).getMc();
			}

			zc = this.getEntpRelaction(entpSexhiInfo.getId(), "ZC");// 支持单位
			xb = this.getEntpRelaction(entpSexhiInfo.getId(), "XB");// 协办单位
			exhiType = this.getEntpRelaction(entpSexhiInfo.getId(), "exhiType");// 展会类型
			zldd = this.getEntpRelaction(entpSexhiInfo.getId(), "zldd");// 展会场馆
			model.addAttribute("logs", auditLogMng.findByProperty("auditId",
					entpSexhiInfo.getId(), " auditTime desc "));
		}
		model.addAttribute("zb", zb);
		model.addAttribute("qt", qt);
		model.addAttribute("cb", cb);
		model.addAttribute("zc", zc);
		model.addAttribute("xb", xb);
		model.addAttribute("exhiType", exhiType);
		model.addAttribute("zldd", zldd);
	}
	
	public void showBexhiView(EntpBexhi entpBexhi, ModelMap model) {
		
		if (null == entpBexhi.getId() || "".equalsIgnoreCase(entpBexhi.getId())) {
			model.addAttribute("projectId", Identities.uuid());
		} else {
			model.addAttribute("projectId", entpBexhi.getId());
		}
		model.addAttribute("info", entpBexhi);
		String zb = "";
		String qt = "";
		String cb = "";
		String zc = "";
		String xb = "";
		String exhiType = "";
		String zldd = "";

		if (entpBexhi.getId() == null) {
			model.addAttribute("projectId", Identities.uuid());
		} else {
			model.addAttribute("projectId", entpBexhi.getId());

			if (null != entpBexhi.getZid()
					&& entpMng.get(entpBexhi.getZid()) != null) {
				zb = entpMng.get(entpBexhi.getZid()).getMc();
			}

			if (null != entpBexhi.getCid()
					&& entpMng.get(entpBexhi.getCid()) != null) {
				cb = entpMng.get(entpBexhi.getCid()).getMc();
			}

			zc = this.getEntpRelaction(entpBexhi.getId(), "ZC");// 支持单位
			xb = this.getEntpRelaction(entpBexhi.getId(), "XB");// 协办单位

			exhiType = this.getEntpRelaction(entpBexhi.getId(), "exhiType");// 展会类型
			zldd = this.getEntpRelaction(entpBexhi.getId(), "zldd");// 展会场馆
			
			model.addAttribute("logs", auditLogMng.findByProperty("auditId",
					entpBexhi.getId(), " auditTime desc "));
		}
		model.addAttribute("zb", zb);
		model.addAttribute("qt", qt);
		model.addAttribute("cb", cb);
		//model.addAttribute("zc", zc);
		//model.addAttribute("xb", xb);
		model.addAttribute("exhiType", exhiType);
		model.addAttribute("zldd", zldd);
	}
	
}
